package com.prs.crm.dao.sys.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.dao.sys.RemindInfoSendSetDao;
import com.prs.crm.domain.sys.RemindInfoSendSet;

public class RemindInfoSendSetDaoImpl extends BaseDaoImpl<RemindInfoSendSet> implements RemindInfoSendSetDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<RemindInfoSendSet> getAllRemindInfoSendSet() {
		Criteria criteria=this.getSession().createCriteria(RemindInfoSendSet.class);
		return criteria.list();
	}

	@Override
	public RemindInfoSendSet getRemindInfoSendSet(final String code) {
		Criteria criteria=this.getSession().createCriteria(RemindInfoSendSet.class);
		criteria.add(Restrictions.eq("type", code));
		List result=criteria.list();
		if(result==null||result.size()==0){
			return null;
		}
		return (RemindInfoSendSet) criteria.list().get(0);
	}

}
